(function () { var hero = document.querySelector("[data-travelgo-hero-panels]"); var panels = hero ? hero.querySelectorAll("[data-service-panel]") : []; var buttons = []; document.querySelectorAll("[data-travelgo-service-nav], [data-travelgo-app-tabbar]").forEach(function (root) { root.querySelectorAll("[data-travelgo-panel-tab][data-service]").forEach(function (el) { buttons.push(el); }); }); if (!buttons.length) return; var hasHero = Boolean(hero && panels.length); function activate(id) { buttons.forEach(function (btn) { var on = btn.getAttribute("data-service") === id; btn.classList.toggle("is-active", on); }); var heroSection = document.querySelector(".travelgo-hero--akbar"); if (heroSection) { heroSection.classList.toggle("travelgo-hero--akbar-flights", id === "flights"); heroSection.classList.toggle("travelgo-hero--akbar-hotel", id === "hotels"); } if (!hasHero) return; panels.forEach(function (panel) { var on = panel.getAttribute("data-service-panel") === id; panel.classList.toggle("is-active", on); if (on) { panel.removeAttribute("hidden"); } else { panel.setAttribute("hidden", "hidden"); } }); try { history.replaceState(null, "", "#" + id); } catch (e) { /* ignore */ } if (window.matchMedia("(max-width: 767px)").matches && hero) { try { hero.scrollIntoView({ behavior: "smooth", block: "start" }); } catch (e2) { /* ignore */ } } } buttons.forEach(function (btn) { btn.addEventListener("click", function (e) { if (!hasHero) return; e.preventDefault(); var id = btn.getAttribute("data-service"); if (id) activate(id); }); }); if (!hasHero) return; var hash = (location.hash || "").replace(/^#/, ""); if (hash && hero.querySelector('[data-service-panel="' + hash + '"]')) { activate(hash); } else { activate("flights"); } })();